$: << File.join(File.expand_path(File.dirname(__FILE__)), "..")

require 'rubygems'
require 'mapper/ColSplit'
require 'test/unit'

class SplitTest < Test::Unit::TestCase
	
	def test_fill
		cls = ColSplit.new('--column=2 --column-delimiter=pipe --limit=5')
		output=cls.execute("hello\tworld\t0|1|2")
		assert_equal(8, output.split("\t").length)
	end
	
	def test_limit
		cls = ColSplit.new('--column=0 --column-delimiter=pipe --limit=5')
		output=cls.execute("0|1|2|3|4|5|6|7|9|10")
		assert_equal(6, output.split("\t").length)		
	end
	
	def test_a
		cls = ColSplit.new('--column=5 --column-delimiter=pipe --limit 5')
		data="163837969	Deshazo and Son Roofing Incorporated	205651635	IY	24496	8001590	Glen Allen	804	23060	4019	VA	VA	37.6397170241998	-77.4597435776068	8505 Brook Rd	(804) 335-0852	Mon-Fri 7am-5pm, Sat Closed, Sun Closed	CHECK, VISA, MASTERCARD	VA268558.gif	30	600	Residential and Commercial Roofing|New Roof, Roof Repair,|Shingle Repair, Flat Roof		2011-01-14 17:25:40.0	http://www.deshazoandsonroofing.com	deshazosonrf@aol.com		N	N	2010-08-05 00:00:00.0	Y	205651635	N	deshazosonrf@aol.com^deshazosonrf@aol.com|	http://deshazoandsonroofing.com^|	(804) 266-6187^|		(877) 429-9607^|		Virginia Class A Contractors License is 2705-058570A.|Better Business Bureau Accredited Business		We are factory approved applicators of: <br /><br />* Celotex Roofing Products <br />* CertainTeed <br />* Firestone Building Products <br />* GAF/Elk Corporation <br />* Polyglass Modified Bitumen Systems <br />* Versico Roofing Systems <br />* Johns- Manville <br />* Duralast	Roofing - First & Foremost!<br /><br />We are qualified to service and install different types of roof systems on the market today.<br /><br />Free Estimates:<br /><br />If you will contact us, we will inspect and identify the cause of your problem. We will then contact you to discuss the methods necessary to repair or replace your leaky roof.	Systems:<br /><br />Shingles:<br /><br />We use shingles varying from 3 tab to dimensional to architectural, etc. as asked on the customer's needs. These shingles come from product lines such as GAF Timberline, Elk Prestique, CertainTeed, Firescreen/Firehalt, TAMKO and Heritage Series among others. Each company offers shingles of different longevity that range anywhere from 20 years to lifetime shingles, all of which are backed up by a manufacturer warranty for their specific longevity.<br /><br />Metal:<br /><br />We apply all styles of metal roofs from Batten to Battenlock to Flatlock to Standing Seam. We utilize the best metals from companies such as Pac Clad and MBCI. These systems of roofs are also protected by warranty, varying by the manufacturer and product.<br /><br />Built Up (Tar and Gravel):<br /><br />We apply 1, 2, 3 and 4 ply systems as well as glazed and slagged systems using products made by Johns Manville, and Celotex, to name a few. Manufacturer's warranties also apply to this type of roof system.<br /><br />Modified Bitumen (BRY):<br /><br />We install various types of modified bitumen roof systems including Polyglass, Usintec, Firestone and GAF. These systems are adaptable for reroofing due to relative light weight properties of the system. These systems can be installed to specifications that will give warranties from ten to twenty years.<br /><br />Acrylic Roof Coatings:<br /><br />We install ASTEC Coatings on metal roofs. This product is guaranteed to minimize expansion and contraction.	Need a Quality Roofing Service In Virginia!		YRVAMZ	Home Improvements	remodel|home repair|bathroom remodel|kitchen remodel|room addition|redecorate|interior decorate3|home remodel|home center|garage builder3|home1|home service|sub contractor|subcontractor|interior redesign|home staging|staging service|home staging service|real estate staging service|house|fence3|tile3|light3					Roofing Contractors~Roofing Contractors-Commercial & Industrial~Home Improvements		20110124"
		puts data.split("\t").inspect
		output = cls.execute(data)
		puts output.split("\t").inspect
	end
	
	
end